<?
	class InputRank extends Input
	{
		var $aLabels = array ( '', 'malo','no vale la pena','normal','muy interesante','imperdible');
		var $nqItems = 5;
		var $cOverText = '';
		var $cDescripcion= '';

		function setDescription( $cDescripcion  )
		{
			$this->cDescripcion = $cDescripcion;
		}

		function setOverText( $cOverText)
		{
			$this->cOverText = $cOverText;
		}
		function setLabel ( $nIndex, $cLabel )
		{
			if ( $nIndex > 0 && $nIndex <= $this->nqItems )
				$this->aLabels[$nIndex] = $cLabel;
		}
		function InputRank( $cLabel, $cField, $nValue = 1,  $nqItems = 5 )
		{
			$this->Input( $cLabel, $cField, $nValue,  false);
			$this->nqItems = $nqItems;
		}

		function make()
		{
			$cPropiedades = $this->getProperties();
			$cReturn = "<div onmouseout='rank_out(\"" . $this->cField . "\",\"" . $this->cDescripcion . "\"); ' ";
			if ( $this->bDisabled )  $cReturn .= " onmouseover='rank_over(\"" . $this->cField . "\",\"" . $this->cOverText . "\");'  ";
			if ( $this->aEvents['onclick'] ) $cReturn .= " onclick='" . $this->aEvents['onclick'] . "'";
			$cReturn .= " class='inputrank_container' style='position: relative;' >";
			for ( $i = 1; $i <= $this->nqItems ; $i++ )
			{
				$cImagenFondo = ( $i <= $this->cValue ) ? URL_IMAGES . "/con_estrella.gif": URL_IMAGES . "/sin_estrella.gif";
				$cReturn .= "<div id='" . $this->cField. "_rank_star$i' ";
				if ( !$this->bDisabled ) $cReturn .= " onclick='star_click(\"" . $this->cField . "\", $i, this);' onmouseover='star_over(\"" . $this->cField . "\",$i, \"" . $this->aLabels[$i] . "\", this);' ";

				$cReturn .= " style=' position: absolute; left:  " . (($i * 20) -10) . "px; width: 20px; height: 20px; background-position: center right; background-repeat: no-repeat;background-image: url(". $cImagenFondo  ."); '></div>";
			}
			$cReturn .= "<br/><div id='" . $this->cField. "_rank_text'  class='inputrank_texto' style='position: absolute;' >" . $this->cDescripcion  ."</div>
				<input $cPropiedades id='" . $this->cField. "' name='" . $this->cField. "' type='hidden' value='". $this->cValue . "' /></div><div>&nbsp;</div>";
			return $cReturn;
		}
	}
?>